package com.knight.hadoop.day12.udf;

import org.apache.hadoop.hive.ql.exec.UDF;
import org.codehaus.jackson.map.ObjectMapper;
/**
 * 自定义json解析
 * @author 
 *
 */
public class Parsejson extends UDF{
	
	
	public String evaluate(String line) {
		ObjectMapper objectMapper = new ObjectMapper();
		try {
			MovieRateBean readValue = objectMapper.readValue(line, MovieRateBean.class);
			return readValue.toString();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return "";
	}
}
